﻿using System;
using Glue.Internals.Nulls;
using Xunit;

namespace GlueTests
{
    public class MaybeTest
    {
        [Fact]
        public void Should_report_it_has_no_value()
        {
            var maybe = new Maybe<String>(null);
            Assert.False(maybe.HasValue());
        }

        [Fact]
        public void Should_report_it_has_value()
        {
            var maybe = new Maybe<String>("a String");
            Assert.True(maybe.HasValue());
        }

        [Fact]
        public void Should_throw_exception_if_you_try_to_get_a_value_that_does_not_exist()
        {
            var maybe = new Maybe<String>(null);
            Assert.Throws(typeof(ArgumentException), () =>
            {
                maybe.GetValue();
            });
        }
    }

}
